package behavioralPattern.observer.example01;

public class Client {
    public static void main(String[] args) {
        // 创建目标类
        Subject subject = new ConcreteSubject();

        // 注册观察者
        ConcreteObserver_1 concreteObserver1 = new ConcreteObserver_1();
        subject.attach(concreteObserver1);
        subject.attach(new ConcreteObserver_2());

        // 通知
        subject.notifyObservers();

        // 注销
        subject.detach(concreteObserver1);

        // 通知
        subject.notifyObservers();
    }
}
